/* ----------------------------------------------------------------------------------------------------------------
 * VisibleCore
 * ----------------------------------------------------------------------------------------------------------------
 */
package pure.engine.core
{
	import flash.display.BitmapData;
	import flash.filters.BitmapFilter;
	import flash.geom.Point;
	import flash.geom.Rectangle;
	
	import pure.utils.DesN;
	import pure.debug.Logger;
	import pure.engine.system.ns_despair;
	
	use namespace ns_despair;
	
	
	/**
	 * 可视物抽象类
	 * @author ＃Pure
	 * 
	 */
public class VisibleCore extends Origin implements IVisible
{

	
	
	//======================
	// Member
	//======================
	
	
	ns_despair var m_x:Number = 0;  // 坐标X
	
	ns_despair var m_y:Number = 0;  // 坐标Y

	ns_despair var m_range:Number = 0;  // 面积
		
	ns_despair var m_angle:Number = 0;  // 弧度
	
	ns_despair var m_visible:Boolean = true;  // 是否可见
		
	ns_despair var m_interactive:Boolean = true;  // 是否可交互

	ns_despair var m_filterList:Array;  // 滤镜列表
	
	ns_despair var m_numFilter:int;  // 滤镜数目
	
	ns_despair var m_realRect:Rectangle;  // 真实矩形（碰撞检测，会产生形变或透明度变化的渲染器通常不能使用）


	
	//======================
	// Cached Object
	//======================

	protected static var cachedPoint:Point = new Point();
	
	protected static var cachedZeroPoint:Point = new Point();


	
	
	
	//======================
	// Property
	//======================
	
	
	// 是否可见
	public function get visible():Boolean 
	{ 
		return m_visible;
	}
	
	public function set visible(b:Boolean):void
	{ 
		// Override !!
	}
	
	
	// 是否可交互
	public function get interactive():Boolean 
	{
		return m_interactive; 
	}
	
	public function set interactive(b:Boolean):void 
	{
		m_interactive = b; 
	}

	
	// 弧度范围 [ 0 ~ PI ~ -PI ~ 0 ]
	public function get angle():Number 
	{ 
		return m_angle; 
	}
	
	public function set angle(v:Number):void 
	{ 
		// Override !!
	}
	
	
	// 角度范围 [ 0 ~ 360 ]
	public function get rotation():Number 
	{
		var n:Number;
		
		n = m_angle * DesN.ONE_EIGHTY_OVER_PI;
		return n < 0 ? n + 360 : n;
	}
	
	public function set rotation(v:Number):void 
	{ 
		this.angle = v * DesN.PI_OVER_ONE_EIGHTY; 
	}
	

	
	
	
	//======================
	// Filter
	//======================
	
	
	public function addFilter(F:BitmapFilter):void
	{
		if (!m_filterList)
		{
			m_filterList = [];
		}
		m_filterList.push(F);
		m_numFilter++;
	}
	
	
	public function clearFilter():void
	{
		m_filterList.length = m_numFilter = 0;
	}
	
	
	

	/* ----------------------------------------------------------------------------------------------------------------
	 * ★★★★★★★★★★★★★★★★★★★★★  private  ★★★★★★★★★★★★★★★★★★★★★
	 * ----------------------------------------------------------------------------------------------------------------
	 */
	
	
		
	
	/**
	 * 毁灭
	 */
	ns_despair function destroy():void
	{
		m_filterList  =  null;
		m_realRect    =  null;
	}
	
	
	
	
}
}